package com.lixianhe.onlineexam.util;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

@Data
public class PageBean<T> {
    private List<T> records;
    private long total;
    private int size;
    private int current;
    private int pages;

    public PageBean(List<T> list, int size) {
        PageInfo<T> pageInfo = new PageInfo<>(list);
        this.records = pageInfo.getList();
        this.total = pageInfo.getTotal();
        this.size = size;
        this.current = pageInfo.getPageNum();
        this.pages = pageInfo.getPages();
    }
}